<?php

namespace app\teacher\controller;

use app\teacher\security\TchCheck as TchCheckLogic;
use app\teacher\model\Thesis as ThesisModel;
use app\teacher\security\Auth as AuthLogic;
use think\Controller;
use think\Session;

class MoreThesis extends Controller
{
    /**
     * 登录界面显示，自动登录
     * @access public
     * @return mixed 返回登录视图
     */
    public function moreThesis($tisId = '')
    {
        //检测是否在审核阶段
        $tchCheck = new TchCheckLogic();
        //检测教师登录情况
        if ($tchCheck->check()) {
            //检测是否有审核员权限
            $auth = new AuthLogic();
            //获取教师工号
            $username = Session::get('token')['tchUsername'];
            if ($auth->check('more', $username)) {
                $thesis = new ThesisModel();
                if ($result = $thesis::where('tisId', $tisId)->find()) {
                    $this->assign('thesis', $result);
                    return $this->fetch('moreThesis/moreThesis');
                } else {
                    return "没有查询到题目，请稍后再试";
                }
            } else {
                return "500：您没查看题目的权限";
            }
        } else {
            return "600：您的登录信息出现问题，请重新登录"
            . "<br>" . "1.您的帐号在其他地方登录"
            . "<br>" . "2.您在线时间过长（5小时以上）"
            . "<br>" . "3.令牌验证错误";
        }
    }

}